/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dca.sistemascontrole.sinais;

/**
 *
 * @author Rafael
 */
public class OndaQuadrada extends Sinal {

    public OndaQuadrada(float periodo, float amplitude, float frequencia, float offset) {
        super(periodo, amplitude, frequencia, offset);
    }

    @Override
    protected float getValue(long t) {
        float deltaT = (t - t0) % periodo;

        if (deltaT < periodo / 2) {
            return -amplitude / 2;
        } else {
            return amplitude / 2;
        }
    }
}
